<?php
$this->load->helper ( "url" );
$uid = md5 ( uniqid ( mt_rand () ) );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>My Facebook App</title> <script type="text/javascript"
		src=<?php echo base_url()."style/ddtabmenu/ddtabmenufiles/ddtabmenu.js"?>>

/***********************************************
* DD Tab Menu script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

	<!-- CSS for Tab Menu #1 -->
	<link rel="stylesheet" type="text/css"
		href=<?php echo base_url()."style/ddtabmenu/ddtabmenufiles/ddtabmenu.css"; ?>>


		<script type="text/javascript">
//SYNTAX: ddtabmenu.definemenu("tab_menu_id", integer OR "auto")
ddtabmenu.definemenu("ddtabs1", 3) //initialize Tab Menu #1 with 1st tab selected

</script>
<!-- spinner-image for upload -->
<script type="text/javascript" src='<?php echo base_url()."style/imageSpinner/script.js"?>'></script>
<link rel="stylesheet" type="text/css" href='<?php echo base_url()."style/imageSpinner/style.css"?>'>

<script>
</script>
<style>
body {
	margin: 0;
	background: #E9EAEE;
}

#ddtabs1 {
	position: fixed;
	background: #44619B;
	width: 100%;
	height: 40px;
}

#ddtabs1 ul {
	margin-top: 10px;
	padding-bottom: 0;
}

#FacebookLogin a {
	text-decoration: none;
	color: #FFFFFF;
	font-weight: bold;
	line-height: 40px;
}

#FacebookLogin img {
	width: 30px;
	height: 30px;
}

.tabcontainer {
	padding-top: 40px;
}

progress[value] {
	appearance: none;
	-moz-appearance: none;
	-webkit-appearance: none;
	width: 200px;
}
</style>
		<body>
			<div id="ddtabs1" class="basictab">
				<ul>
					<li><a title="watermark your image" onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionWatermark/Watermark")."'"?>
						rel="Watermark">Đóng dấu ảnh</a></li>
					<li><a title="add background to your images" onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionTwoImages/TwoImages")."'"?>
						rel="TwoImages">Ghép ảnh nền</a></li>
					<li><a title="beautiful frames for your pictures" onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionFrame/Frame")."'"?>
						rel="Frames">Khung ảnh</a></li>
					<li><a title="look like cartoon pictures" onclick="loadAjax();"
						href="#"
						rel="Cartoon">Ảnh hoạt hình</a></li>
					<!-- <li><a title="OLDAGE" onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionIn20Years/In20Years")."'"?>>OldAge</a></li> -->
					<li><a display="none"></a></li>
					<li><a title="make yourself looks like superman, ..." onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionFunnyEffect/FunnyEffect")."'"?>>Hiệu ứng vui</a></li>
					
					<li><a title="make your picture in pencil" onclick="loadAjax();"
						href=<?php echo "'".base_url("index.php/FunctionSketch/Sketch")."'"?>>Ảnh chì</a></li>
				</ul>
				<div id="FacebookLogin">
					<?php
					echo "<a href='";
					if (! isset ( $_SESSION ["userId"] ))
						echo "http://localhost/ImageProcessing/index.php/FacebookLogin/FacebookLogin";
					else if (strcmp ( $_SESSION ["userName"], "Anonymous" ) == 0)
						echo "http://localhost/ImageProcessing/index.php/FacebookLogin/FacebookLogin";
					else
						echo "http://facebook.com/me";
					echo "'>";
					echo "<img src='";
					echo $_SESSION ["profilePicture"] . "'";
					echo "/>";
					echo "<span>";
					echo $_SESSION ["userName"];
					echo "</span>";
					echo "</a>";
					?>
				<?php
				if (! isset ( $_SESSION ["userId"] )) {
					echo "<img src = ";
					echo base_url () . "/UserUploads/fb-login.jpg";
					echo "></img>";
				} else {
					if (strcmp ( $_SESSION ["userName"], "Anonymous" ) == 0) {
						echo "<img src = ";
						echo base_url () . "/UserUploads/fb-login.jpg";
						echo "></img>";
					} else {
						echo "<a class='logout' href=" . base_url ( "/index.php/FacebookLogout/FacebookLogout" ) . " style='padding-left:10px'>";
						echo "Đăng xuất";
						echo "</a>";
					}
				}
				?>	
			</a>
				</div>
			</div>


			<div class="tabcontainer">

				<div id="Watermark" class="tabcontent">Đóng dấu ảnh</div>

				<div id="TwoImages" class="tabcontent">Ghép ảnh nền</div>

				<div id="Frames" class="tabcontent">Khung ảnh</div>

				<div id="Cartoon" class="tabcontent">Ảnh hoạt hình</div>

				<div id="OldAge" class="tabcontent">OldAge</div>

				<div id="FunnyEffect" class="tabcontent">Hiệu ứng vui</div>
				<div id="Sketch" class="tabcontent">Ảnh chì</div>
			</div>

			<div class="imageupload">
				<img
					src=<?php
					if (isset($_SESSION["imagePath"]))
						echo $_SESSION["imagePath"];
					else
						echo base_url () . "UserUploads/default.jpg";
					?>
					<?php
					if (!isset($_SESSION["imagePath"])) {
						$userId = $_SESSION ["userId"];
						$imageName = "default.jpg";
						$imgSize = getimagesize ( "./UserUploads/$imageName" );
					} else{
						$imgSize = getimagesize ($_SESSION["imagePath"]);
					}	
					
					
					echo "alt='resizeimg' width=200 height=$imgSize[1]*200/$imgSize[0]";
					?> />
				<form id="imageUpload" method="post" enctype="multipart/form-data"
					action=<?php echo base_url("index.php/ImageUpload/ImageUpload/process");?>
					index.php/ImageUpload/ImageUpload/process>
					<label for="image">Chọn ảnh</label>
					</br> <input type="file" id="imageUpload" name="imageUpload"> </input>
					</br> <input type="submit" value="Đăng ảnh" onclick="loadAjax();"> </input>
					
										
				</form>
				
				<div id="content">
			        <div id="results"><!-- Results are displayed here --></div>
			        <div id="fade"></div>
			        <div id="modal">
			            <img id="loader" src="<?php echo base_url()."style/imageSpinner/"?>images/loading.gif" />
			        </div>
			    </div>

	<?php
	echo $this->session->flashdata ( 'Error' );
	?>
	</div>
